import React from "react";
import { HashRouter as Router, Routes, Route } from "react-router-dom";
import { NextUIProvider } from "@nextui-org/react";
import { ConfigProvider } from "antd";
import ReactDOM from "react-dom/client";
import zhCN from "antd/es/locale/zh_CN";

import App from "./App.jsx";
import "./assets/css/tailwind.css";

import AppProvider from "./components/AppProvider";

import Login from "./view/login/Login";
import NotFound from "./view/notFound/NotFound";

ReactDOM.createRoot(document.getElementById("root")).render(
  <React.StrictMode>
    <NextUIProvider>
      <AppProvider>
        <ConfigProvider locale={zhCN}>
          <Router>
            <Routes>
              <Route path="/" element={<Login />} />
              {/* 登录之后才能访问的路由 */}
              <Route path="/layouts/*" element={<App />} />
              {/* 或者跳转到 NotFound */}
              <Route path="*" element={<NotFound />} />
            </Routes>
          </Router>
        </ConfigProvider>
      </AppProvider>
    </NextUIProvider>
  </React.StrictMode>
);
